﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Omes.Webserver
{
    public class JsServer : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string meth = context.Request.HttpMethod;
            switch (meth)
            {
                case "GET":
                    {
                        this.Get(context);
                    }break;
                case "POST":
                    {
                        this.Post(context);
                    }
                    break;
            }
        }

        private void Get(HttpContext context)
        {
            string result = string.Empty;
            string path = context.Request.Path.ToLower();
            //去掉path在web.config中的部分
            int index = path.IndexOf('/', 1);
            path = path.Substring(index);
            switch (path)
            {
                case "/page/update":
                    {
                    }
                    break;
                case "/page/delete":
                    {
                    }break;
                case"/all/menutype":
                    {

                    }break;
            }
            context.Response.ContentEncoding = System.Text.Encoding.UTF8;
            context.Response.Write(result);
        }

        private void Post(HttpContext context)
        {
        }

        public bool IsReusable
        {
            get { return false; }
        }
    }
}